package com.martini.satoken01.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.Objects;

/**
 * @author martini at 2021/12/18 09:03
 */
public class RequestContext {
    public static HttpServletRequest getHttpRequest() {
        ServletRequestAttributes requestAttributes = Objects.requireNonNull((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
        return requestAttributes.getRequest();
    }
}
